package com.hn.hnspringbootdemo.service.impl;

import com.hn.hnspringbootdemo.entity.*;
import com.hn.hnspringbootdemo.service.TestService;
import org.springframework.stereotype.Service;

@Service
public class TestServiceImpl implements TestService {

    @Override
    public OutParameter<QueryOweFeeResponse> getQueryOweFee(Params<QueryOweFeeParams> p) {
        System.out.println("经过一些列操作返回参数。。。。");
        // 设置业务出参
        QueryOweFeeResponse queryOweFeeResponse = new QueryOweFeeResponse();
        /*
        IVR调用接口的状态返回值
        0 成功
        1 失败
        111 系统异常
        */
        queryOweFeeResponse.setoRet("0");
        // 统一接口平台原始返回码
        queryOweFeeResponse.setResultCode("100861111");
        // 统一接口平台原始返回码描述
        queryOweFeeResponse.setResultDesc("甘肃1008611平台");
        // 统一接口平台转换后的返回值
        // 0 查询成功
        //1 11 查询失败
        queryOweFeeResponse.setoServiceRet("0");
        // GFEP返回Header头中X-Trans-Id值
        queryOweFeeResponse.setoSerialNo("yzgdjskjdk");
        // 余额
        queryOweFeeResponse.setoOweTotalFee("66.66");

        // 设置错误出参
        ResponseErrorInfo responseErrorInfo = new ResponseErrorInfo();
        responseErrorInfo.setMessge("成功");
        responseErrorInfo.setCode("00000");
        //组合出参
        Response response = new Response();
        response.setErrorInfo(responseErrorInfo);
        response.setRetInfo(queryOweFeeResponse);
        // 创建出参
        OutParameter<QueryOweFeeResponse> outParameter = new OutParameter<QueryOweFeeResponse>();
        outParameter.setResponse(response);
        System.out.println("出参--------------"+ outParameter.toString());
        return outParameter;
    }

    @Override
    public OutParameter<QuerySpeFundsResponse> getQuerySpeFunds(Params<QueryOweFeeParams> p) {
        System.out.println("经过一些列操作返回参数。。。。");
        // 设置业务出参
        QuerySpeFundsResponse querySpeFundsResponse = new QuerySpeFundsResponse();
        // IVR调用接口的状态返回值
        // 0 成功
        // 1 失败
        // 111 系统异常
        querySpeFundsResponse.setoRet("0");
        // 统一接口平台原始返回码
        querySpeFundsResponse.setResultCode("100861111");
        // 统一接口平台原始返回码描述
        querySpeFundsResponse.setResultDesc("甘肃1008611平台");
        // 统一接口平台转换后的返回值
        // 0 查询成功
        //1 11 查询失败
        querySpeFundsResponse.setoServiceRet("0");
        // GFEP返回Header头中X-Trans-Id值
        querySpeFundsResponse.setoSerialNo("yzgdjskjdk");
        // 专款余额
        querySpeFundsResponse.setoSpeFunds("66.66");

        // 设置错误出参
        ResponseErrorInfo responseErrorInfo = new ResponseErrorInfo();
        responseErrorInfo.setMessge("成功");
        responseErrorInfo.setCode("00000");
        //组合出参
        Response response = new Response();
        response.setErrorInfo(responseErrorInfo);
        response.setRetInfo(querySpeFundsResponse);
        // 创建出参
        OutParameter<QuerySpeFundsResponse> outParameter = new OutParameter<QuerySpeFundsResponse>();
        outParameter.setResponse(response);
        System.out.println("出参--------------"+ outParameter);
        return outParameter;
    }
}
